package com.mask.im.business.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;


/**
 * @author jian
 */
@Configuration
public class RestClientConfig {

    @Bean
    public RestTemplate restTemplate() {
        HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
        // 设置连接超时时间
        requestFactory.setConnectTimeout(5000);
        // 设置读取超时时间
        requestFactory.setReadTimeout(5000);
        return new RestTemplate(requestFactory);
    }
}
